// Created by Roman Novitsky on 25.05.2009


#region Imported Namespaces


using System.Collections.Generic;


#endregion


namespace WtfManager.EditingHistory
{
  public class ChangeSet: Change
  {
    #region Fields


    private readonly List<Change> _changes;
    private readonly string _details;
    private readonly string _name;


    #endregion


    #region Constructors/Finalizers


    public ChangeSet(string name, string details, List<Change> changes)
    {
      _details = details;
      _name = name;
      _changes = changes;
    }


    #endregion


    #region Properties/Indexers


    public override string Details
    {
      get
      {
        return _details;
      }
    }

    public override string Name
    {
      get
      {
        return _name;
      }
    }


    #endregion


    #region Methods


    protected override void Execute()
    {
      foreach (Change change in _changes)
      {
        change.Do();
      }
    }


    protected override void Revert()
    {
      foreach (Change change in _changes)
      {
        change.Undo();
      }
    }


    #endregion
  }
}